import { decrypt } from "../libs/decrypt.js";

export function decode(req, res, next){
  // 密钥
  let keyStr = 'KI6859d&9lF@AA4$';
  if(req.method === 'POST'){
    req.body = decrypt(keyStr, req.body.portalReq)
    console.log('请求体：',req.body)
  }
  if(req.method === 'GET'){
    if(req.query.portalReq){
    req.query = decrypt(keyStr, req.query.portalReq)
    }
    console.log('请求参数', req.query)
  }

  next()
}